﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BUS;
using DTO;

namespace MasterPageGroupF3
{
    public partial class Default : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {            
            CITY[] citys = CITYBUS.LayBang();
            foreach (CITY temp in citys)
            {
                ddlThanhPho.Items.Add(temp.NAME);
            }  
        }

        protected void btnGui_Click(object sender, EventArgs e)
        {
            if (!REGISTER_MAILBUS.DaDangKy(txtEmailNhan.Text, ddlThanhPho.SelectedItem.Text))
            {
                REGISTER_MAIL regMail = new REGISTER_MAIL();
                regMail.EMAIL = txtEmailNhan.Text;
                regMail.CITY = ddlThanhPho.SelectedItem.Text;
                REGISTER_MAILBUS.DangKyNhanTinKM(regMail);
            }
            else
            {
                Response.Write("<script language='javascript'>alert('Email này đã đăng ký.');</script>");
            }

        }
        //protected void lbTaiKhoan_Click(object sender, EventArgs e)
        //{
        //    if (Session["Provider"] != null)
        //    {
        //        Response .Redirect ("~/ho-chi-minh/DoiThongTinDoanhNghiep.aspx");
        //    }
        //}
    }
}
